# name the installer
outFile "INSTALLER_NAME"
BrandingText /TRIMRIGHT "etcfg.Launch"
Caption "etcfg.Launch Setup"
DirText "This programm will install etcfg.Launch and all depedencies on your computer"
Icon "etcfgIcon.ico";
RequestExecutionLevel admin


Page directory
Page instfiles







#default section start
section
   
    setOutPath $INSTDIR
    file etcfgLaunch.exe
    file etcfgLaunch.jar
    file etcfgIcon.ico
    
    writeUninstaller $INSTDIR\uninstall.exe
 
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" \
                 "DisplayName" "etcfg.Launch - simple ET server browser"
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" \
                 "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" \
                 "DisplayIcon" "$\"$INSTDIR\etcfgIcon.ico$\""  
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" \
                 "Publisher" "etcfg.com"
    WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" \
                 "DisplayVersion" "LOCAL_BUILD_VERSION"             
    
    MessageBox MB_OKCANCEL "Do you want to createshortcuts at the desktop and Start menu?" IDYES lbl_createshortcuts
    lbl_createshortcuts:
        CreateDirectory "$SMPROGRAMS\etcfgLaunch"
        createShortCut "$SMPROGRAMS\etcfgLaunch\Start Etcfg Launch.lnk" "$INSTDIR\etcfgLaunch.exe"
        createShortCut "$SMPROGRAMS\etcfgLaunch\Unistall Etcfg Launch.lnk" "$INSTDIR\uninstall.exe"
        createShortCut "$DESKTOP\Start Etcfg Launch.lnk" "$INSTDIR\etcfgLaunch.exe"
    
    
    # read the value from the registry into the $0 register
    readRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" CurrentVersion
    
    
    
    MessageBox MB_OKCANCEL "Do you want to integrate with HLSW?" IDYES lbl_integrate 
    lbl_integrate:
        WriteRegStr HKCU "Software\HLSW\Settings" "ETDir" "$INSTDIR"
        WriteRegStr HKCU "Software\HLSW\Settings" "ETEXEFile" "etcfgLaunch.exe"
        MessageBox MB_OK "Integration finished, restart HLSW"
   
  
    
    
 
   
    
    StrCmp $0 "1.6" lbl_skipjre
    
    File "jxpiinstall.exe"
    ExecWait "$INSTDIR\jxpiinstall.exe"
    Delete "$INSTDIR\jxpiinstall.exe"
    lbl_skipjre:
        #nothing here
    
    
   
    
 
# default section end
sectionEnd

Section "uninstall"
     delete "$INSTDIR\uninstall.exe"
     delete "$INSTDIR\etcfgLaunch.exe"
     delete "$INSTDIR\etcfgLaunch.jar"
     delete "$INSTDIR\settings.properties"
     delete "$SMPROGRAMS\etcfgLaunch\Start Etcfg Launch.lnk" 
     delete "$SMPROGRAMS\etcfgLaunch\Unistall Etcfg Launch.lnk"
     delete "$DESKTOP\Start Etcfg Launch.lnk"
     delete "$INSTDIR\etcfgIcon.ico"    
     RMDir "$SMPROGRAMS\etcfgLaunch"
     DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\etcfgLaunch" 
SectionEnd

Function .onInit
     StrCpy $INSTDIR "$PROGRAMFILES32\etcfgLaunch"    
     
FunctionEnd
